--[[

PROGRAM NAME:	Badlands Lite
VERSION:		3.21 to 3.3
AUTHOR:			Gig (2021)

This file is part of TIMEGAL

	TIMEGAL is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation.

	TIMEGAL is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	Thanks to RDG (original author of the program).

]]--


-------------------------
-- 1. General settings --
-------------------------

-- Hypseus Game Setup --

-- Do Not Remove/Alter these --
OVERLAY_FULL     = 1
OVERLAY_HALF     = 2
OVERLAY_OVERSIZE = 3
-- Do Not Remove/Alter these --

BASEDIR = "singe"                                  -- This should be 'singe'

BASEOVERLAY = OVERLAY_FULL                         -- Set the default Overlay

MYDIR = BASEDIR .."/".. "badlands"                      -- This is the directory where your game is



scoreBezelEnable(false, BEZEL_LAIR)

-- End Hypseus Game Setup --
MovieFPS = 29.97								-- Number of frames per second of your movies (used for timed actions).

dofile("./Singe/Script/globals.singe")			-- Don't touch this line

-- Scoring Settings --

SCOREMOVE = 700									-- Points for a correct move. A difficulty buff will then be applyied. 
BUFFMOVE = 300									-- Each difficulty level above "easy" will add this value for a correct move.
SCORESCENE = 5000								-- Points for finishing a Scene. Each death will then reduce this score.
SCORELEVEL = 20000								-- Points for finishing a Level.
SCOREGAME = 100000								-- Points for finishing the Game.
PERFECTBONUS = 10000							-- Points for finishing a level with 0 death
EXTRALIFE = 0									-- Points needed for Extra life (0 = No Extra Life)
DEATHPENALTY = 1000								-- Each death will reduce the score of the scene by this value. 
SCORESECRET = 1									-- Points for finishing the Game with one life : 1 point that makes a difference!

-- Difficulty Settings --						-- Normally, you don't need to change those settings 
gap = 9											-- number of frames difference default 9, 10, 11
									

PenalNormal = 1									-- Number of input frames to remove for level Normal.
PenalHard = 2									-- Number of input frames to remove for level Hard.	
PenalExtreme  = 3									-- Number of input frames to remove for level Extreme.	

-- Advanced Settings --							-- Those settings allow to setup complex behavior. You don't need them in most cases.

 altCfg = false	
 
 miscR = 68										-- You can also choose MISC to create your own color
 miscG = 225										-- In that case fill RGB values (0 to 255)
 miscB = 255
 
AllowRandom = false								-- Show/hide the random level order mode in Game Type (menu)

AllowTier = true								--	Show/hide the tier mode in Game Type (menu). If you don't want tiers: false.
Tiers[0] = {4,1,3,3,2}					
Tiers[1] = {1}									-- levels that will be played randomly during tier 1.
Tiers[2] = {2,3,4}  							-- when all levels of tier 1 are played, we play those levels.
Tiers[3] = {5,6,7}									
Tiers[4] = {8,9}

AllowMap = false								-- Show/hide the map mode in Game Type (menu)
MapStart = 0									-- 0: Map start at the beginning / 1: Map after the first level. 

IngameDiffchoice = false						-- If true, you will choose the difficulty with a video at the start of the game.

BarSize = 8									-- Size of the Life Bar (Life bar Game Type)
BarMin = 2										-- Decrease of the Life bar for missed move
BarBonus = 2									-- Number of good moves to gain 1 in Life Bar	 

LvlTrophy3 = 3
LvlTrophy4 = 5


------------------------------------------------------------------------
-- 2. Starting and ending frames for the various elements of the game --
------------------------------------------------------------------------
													
-- Intro frames --
												-- For this part, you just need to adjust the frames values.
offsetTitle = 3119				 --3119  no intro-- 2624 full intro	     Title start frame (short video with the logo).
offsetTitleend = 3120 -- 3063							-- End frame of the title video. 

offsetIntro01 = 3123								-- Attract video start frame.
offsetIntro01end = 4414							-- End frame of the Attract video #1.

offsetIntro02 = 0							-- You can have a third attract video.
offsetIntro02end = 1						-- I've got only 1 so i just matched The rankings video values.

offsetIntro03 = 2624	 	  						-- Attract video #2 start frame (if you've got only one : match title or Intro01).
offsetIntro03end = 3063							-- End frame of the Attract video #2.

offsetIntroGame = 0   							
offsetIntroGameend = 0	

-- Menu frames --

offsetMenus = 0								-- Menu video start frame (continue, high score, game over, etc).														
												-- Now we set the frames for the menu video.
frameOptions = offsetMenus +32					
frameSave = offsetMenus +152
frameRankings =offsetMenus +212	
frameControls = offsetMenus +272
frameSpecial = offsetMenus +332	
frameVictory = offsetMenus +92				
frameSecret = offsetMenus +394					
frameTrophy = offsetMenus +464		-- 464			
frameHints = offsetMenus +522	

frameEasy = offsetMenus +2140						
frameNormal = offsetMenus +2146					
frameHard = offsetMenus +2151
frameExtreme = offsetMenus +2157

offsetGameOver = offsetMenus +573				
offsetGameOverend = offsetMenus +631

offsetGameOverAlt = offsetMenus +633			
offsetGameOverAltend = offsetMenus +662		

offsetNewHScore = offsetMenus +693				
offsetNewHScoreend = offsetMenus +731			

offsetEnterHScore = offsetMenus +1023			
offsetEnterHScoreend = offsetMenus +1323		

offsetRankings = offsetMenus +1354			
offsetRankingsend = offsetMenus +1665			

offsetContinue = offsetMenus +1696		
offsetContinueend = offsetMenus +2025

offsetClear = offsetMenus +2056					
offsetClearend = offsetMenus +2135

offsetGetReady = offsetMenus +2234				
offsetGetReadyEnd = offsetMenus +2273	

offsetSupDeath = 20453		--- da scene death barella in rosso				-- in menu era a 2310								
offsetSupDeathEnd = 20632			--- in menu era a 2419							

offsetMap = offsetMenus +2444						
offsetMapend = offsetMenus +2593					

-- Death frames --

totalDeath = 42
offsetDeath = 18228					-- Start frame for the death video.

Death[01] = {offsetDeath+2224, offsetDeath+2403}   --   provvisoria   (barella da dx verso sx sfondo rosso)

--- deaths level 1
Death[02] = {offsetDeath+32, offsetDeath+181}
Death[03] = {offsetDeath+209, offsetDeath+276}
Death[04] = {offsetDeath+307, offsetDeath+489}
Death[05] = {offsetDeath+519, offsetDeath+767}
Death[06] = {offsetDeath+799, offsetDeath+962}
Death[07] = {offsetDeath+992, offsetDeath+1102}
Death[08] = {offsetDeath+1382, offsetDeath+1465}

---- deaths level 2
Death[09] = {offsetDeath+1690, offsetDeath+1815}
Death[10] = {offsetDeath+3185, offsetDeath+3288}
Death[11] = {offsetDeath+3309, offsetDeath+3378}	---    death pipistrelli
Death[12] = {offsetDeath+3499, offsetDeath+3664}
Death[13] = {offsetDeath+3689, offsetDeath+3799}	---- scena morte scheletro

---- deaths level 3 
Death[14] = {offsetDeath+3816, offsetDeath+3933}
Death[15] = {offsetDeath+3960, offsetDeath+4057}
Death[16] = {offsetDeath+4082, offsetDeath+4175}
Death[17] = {offsetDeath+4200, offsetDeath+4261}
Death[18] = {offsetDeath+4820, offsetDeath+4892}	--- ucciso standard

----- deaths level 4
Death[19] = {offsetDeath+4287, offsetDeath+4448}	---	barca

---- deaths level 5
Death[20] = {offsetDeath+4724, offsetDeath+4793}
Death[21] = {offsetDeath+4818, offsetDeath+4892}
Death[22] = {offsetDeath+4918, offsetDeath+5042}
Death[23] = {offsetDeath+5068, offsetDeath+5204}	--- investito carrozza rifare

--- death level 6 
Death[24] = {offsetDeath+5782, offsetDeath+5905}	-- ponte sospeso
Death[25] = {offsetDeath+5930, offsetDeath+6184}	-- da sopra treno
--- death level 8    lady and saloon
Death[26] = {offsetDeath+6318, offsetDeath+6442}
Death[27] = {offsetDeath+6561, offsetDeath+6698}
Death[28] = {offsetDeath+6725, offsetDeath+6862}
Death[29] = {offsetDeath+6881, offsetDeath+7010}

--- death level 9	bank robbers
Death[30] = {offsetDeath+7030, offsetDeath+7109}
Death[31] = {offsetDeath+7129, offsetDeath+7217}
Death[32] = {offsetDeath+7237, offsetDeath+7386}
--- death level 7  town part 2 posticipate
Death[33] = {offsetDeath+7406, offsetDeath+7485}
Death[34] = {offsetDeath+7504, offsetDeath+7627}
Death[35] = {offsetDeath+7646, offsetDeath+7782}
Death[36] = {offsetDeath+7802, offsetDeath+7905}
--- death level 10	The Final 
Death[37] = {offsetDeath+7924, offsetDeath+8088}
---   								morti varie e scene
Death[38] = {offsetDeath+8101, offsetDeath+8183}	-- Impiccato
Death[39] = {offsetDeath+8201, offsetDeath+8273}	-- carcerato
Death[40] = {offsetDeath+8292, offsetDeath+8457}	-- zoppo
Death[41] = {offsetDeath+8476, offsetDeath+8565}	-- sbiadito / avvelenato
Death[42] = {offsetDeath+8584, offsetDeath+8856}	-- game over scene (angelo)



-- Stages Settings --

finalstage = 10	     		     				-- Last stage of the story. Prevent the game to go to a level that does not exist.
PlayOrder = {1,2,3,4,5,6,7,8,9,10}						-- Normal order of play for the levels. You can have up to 16 levels in your game.
												-- You can also add 16 extra mirror levels and a secret level (see manual).
AllowSecret = false		  						-- If you have a "secret level" video then: replace false by true.
RelativeFrames = true 							-- True if the move frames starts with the level. False if they start with the disc.	    							


Level[1] = {"The begin", 4416, 5623, 1, 0, 0, -1}
Level[2] = {"Forest - Caves", 6906, 7255, 1, 0, 0, 5}
Level[3] = {"Monsters - River", 8746, 8747, 1, 0, 0, 5}
Level[4] = {"Boats", 10218, 10219, 1, 0, 0, 5}
Level[5] = {"Town", 10642, 11009, 1, 0, 0, 5}
Level[6] = {"Bridge - Train", 11974, 11975, 1, 0, 0, 5}
Level[7] = {"Town part 2", 13001, 13002, 1, 0, 0, 5}
Level[8] = {"Lady - saloon", 13839, 13840, 1, 0, 0, 5}
Level[9] = {"Bank robbers", 15597, 15598, 1, 0, 0, 5}
Level[10] = {"The final", 16481, 16482, 1, 0, 0, -1}


------------------------------------------------------------------------------------
-- 3. List of moves for each level, by scene (StartFrame, EndFrame, MOVE, Death#) --
------------------------------------------------------------------------------------

-- A scene is a list of moves you need to complete without "dying" in order to advance to the next scene.
-- If you die during a scene, you restart this scene (though you can alter this in the game's menu).
-- Basic moves: UP, DOWN, LEFT, RIGHT, BUTTON1, BUTTON2, BUTTON3.
-- Combined moves: UPLEFT (diagonal move), UPRIGHT, DOWNLEFT, DOWNRIGHT, ACTUP (BUTTON1 + UP), ACTDOWN, ACTLEFT, ACTRIGHT.  
-- Advanced moves: MASH (hit BUTTON1 quickly), MASHMAX, MASHMIN, HOLDUP (push UP and hold it), HOLDDOWN, HOLDLEFT, HOLDRIGHT, LETGO (release the HOLD), CHOOSE. 
-- Other moves : SKIP (skip some narrative frames), PATHUD (choose between UP and DOWN), PATHLR.


function setupMoves(thisLevel, thisScene)					

	if thisLevel == 1 then										-- The begin  City
	
		if thisScene == 1 then 							

			sceneStart = 1207
			sceneEnd   = 2484							
			totalMoves = 8									

			move[1] = {1267-gap, 1267, BUTTON1, 2}
			move[2] = {1413-gap, 1413, BUTTON1, 3}
			move[3] = {1587-gap, 1587, BUTTON1, 4}
			move[4] = {1979-gap, 1979, BUTTON1, 5}				-- Snakes and Indian axes
			move[5] = {2116-gap, 2116, BUTTON1, 6}
			move[6] = {2202-gap, 2202, BUTTON1, 7}
			move[7] = {2259-gap, 2259, BUTTON1, 8}
			move[8] = {2362-gap, 2362, BUTTON1, 8}
		
		end
	
	elseif thisLevel == 2 then									-- Forest - Caves
	
		if thisScene == 1 then 

			sceneStart = 350
			sceneEnd   = 1839
			totalMoves = 5
		
			move[1] = {636-gap, 636, BUTTON1, 9}
			move[2] = {846-gap, 846, BUTTON1, 10}
			move[3] = {1200-gap, 1200, BUTTON1, 11}
			move[4] = {1372-gap, 1372, BUTTON1, 12}
			move[5] = {1648-gap, 1648, BUTTON1, 13}
		
		end
	
	elseif thisLevel == 3 then									-- Monsters - River

		if thisScene == 1 then   										

			sceneStart = 30
			sceneEnd   = 1469
			totalMoves = 7

			move[1] = {146-gap, 146, BUTTON1, 14}
			move[2] = {406-gap, 406, BUTTON1, 15}
			move[3] = {545-gap, 545, BUTTON1, 16}
			move[4] = {1094-gap, 1094, BUTTON1, 17}					
			move[5] = {1227-gap, 1227, BUTTON1, 18}
			move[6] = {1308-gap, 1308, BUTTON1, 18}
			move[7] = {1376-gap, 1376, BUTTON1, 18}
			
		end
	

	elseif thisLevel == 4 then										-- Boats	

		if thisScene == 1 then   										

			sceneStart = 30
			sceneEnd   = 395
			totalMoves = 1

			move[1] = {254-gap, 254, BUTTON1, 19}
		        
		end
	
	elseif thisLevel == 5 then										-- Town

		if thisScene == 1 then   										

			sceneStart = 368
			sceneEnd   = 1326
			totalMoves = 5

			move[1] = {422-gap, 422, BUTTON1, 20}
			move[2] = {567-gap, 567, BUTTON1, 21}
			move[3] = {675-gap, 675, BUTTON1, 22}
			move[4] = {870, 1200, SKIP, 1}
			move[5] = {1256-gap, 1256, BUTTON1, 23}
		
		end
	
	elseif thisLevel == 6 then										-- Bridge - Train

		if thisScene == 1 then   										

			sceneStart = 2
			sceneEnd   = 1025
			totalMoves = 2

			move[1] = {306-gap, 306, BUTTON1, 24}  	-- ponte sospeso
			move[2] = {892-gap, 892, BUTTON1, 25}	-- da sopra treno	
			
			end
	
	elseif thisLevel == 7 then										-- Town part 2	

		if thisScene == 1 then   										

			sceneStart = 2
			sceneEnd   = 838
			totalMoves = 4

			move[1] = {62-gap, 62, BUTTON1, 33}
			move[2] = {317-gap, 317, BUTTON1, 34}
			move[3] = {487-gap, 487, BUTTON1, 35}
			move[4] = {671-gap, 671, BUTTON1, 36}

			end
	
	elseif thisLevel == 8 then										-- Lady - saloon	

		if thisScene == 1 then   										

			sceneStart = 2
			sceneEnd   = 1753
			totalMoves = 4

			move[1] = {377-gap, 377, BUTTON1, 26}
			move[2] = {1439-gap, 1439, BUTTON1, 27}		
			move[3] = {1495-gap, 1495, BUTTON1, 28}		
			move[4] = {1645-gap, 1645, BUTTON1, 29}
		
			end
	
	elseif thisLevel == 9 then										-- Bank robbers	

		if thisScene == 1 then   										

			sceneStart = 2
			sceneEnd   = 879
			totalMoves = 3

			move[1] = {395-gap, 395, BUTTON1, 30}
			move[2] = {554-gap, 554, BUTTON1, 31}		
			move[3] = {785-gap, 785, BUTTON1, 32}		
		
			end
	
	elseif thisLevel == 10 then										-- The final

		if thisScene == 1 then   										

			sceneStart = 2
			sceneEnd   = 1685
			totalMoves = 3

			move[1] = {653-gap, 653, BUTTON1, 1}
			move[2] = {705-gap, 705, BUTTON1, 1}		
			move[3] = {1006-gap, 1006, BUTTON1, 37}
		
			end

	end
	
end